package utils

import (
	"math/rand"
	"strconv"
	"strings"
	"time"
)

// RandomNumber generates a random number between lo and hi.
func RandomNumber(lo, hi int64) int64 {
	rand.Seed(time.Now().UnixNano())
	return lo + rand.Int63n(hi-lo)
}

func MustAtoi(a string) (i int64) {
	i, _ = Atoi(strings.TrimSpace(a))
	return
}

func Atoi(a string) (i int64, err error) {
	return strconv.ParseInt(a, 10, 64)
}

func Itoa(i int64) string {
	return strconv.FormatInt(i, 10)
}
